<?php

namespace App\Http\Controllers\Api;

use App\Models\Article;
use App\Models\Card;
use App\Models\User;
use App\Models\Video;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;

class HomeController extends ApiController
{

  public function Home(){
      //查询最新的文章
      $article = Article::orderby('created_at','desc')->limit(1)->first();
      $video = Video::orderby('id','desc')->limit(1)->first();
      //查找最佳学员称号
      $data = User::getBest();
      return self::returnAjax(['article'=>$article,'video'=>$video,'list'=>$data], 200, "首页");
  }
}
